<template>
  <a-layout style="min-height: 100vh">
    <a-layout-sider v-model="collapsed" collapsible>
      <div class="logo"></div>
      <a-menu @select="turnToPage" theme="dark" mode="inline">
        <a-sub-menu key="1">
          <span slot="title">
            <a-icon type="pie-chart" />
            <span>系统管理</span>
          </span>
          <a-menu-item key="admin">管理员</a-menu-item>
          <a-menu-item key="role">角色</a-menu-item>
          <a-menu-item key="promise">权限</a-menu-item>
          <a-menu-item  key="menu">菜单</a-menu-item>
        </a-sub-menu>
        <a-menu-item key="2">
          <a-icon type="desktop" />
          <span>用户管理</span>
        </a-menu-item>
      </a-menu>
    </a-layout-sider>
    <a-layout>
      <a-layout-header style="background: #fff; padding: 0">
        <a-icon
          class="trigger"
          :type="collapsed ? 'menu-unfold' : 'menu-fold'"
          @click="() => (collapsed = !collapsed)"
        />
      </a-layout-header>
      <a-layout-content style="margin: 0 16px">
        <a-breadcrumb style="margin: 16px 0">
          <a-breadcrumb-item>User</a-breadcrumb-item>
          <a-breadcrumb-item>Bill</a-breadcrumb-item>
        </a-breadcrumb>
        <div class="content">
          <router-view />
        </div>
      </a-layout-content>
      <a-layout-footer style="text-align: center">©2018 Created by YoYo</a-layout-footer>
    </a-layout>
  </a-layout>
</template>

<script>
import {menus} from '@/api/common'
export default {
  name: "Home",
  data() {
    return {
      collapsible: true,
      collapsed: true,
    };
  },
  created() {
    console.log(11);
    menus().then(res=>{
      console.log(res)
    })
  },
  methods: {
    turnToPage(item,key,keys) {
      console.log(item)
      console.log(this.$router)
      this.$router.push(item.key)
    }
  }
};
</script>

<style lang="less" scoped>
.content {
  background: #fff;
  display: flex;
  height: 100%;
  min-height: 360px;
  padding: 16px 16px 0 16px;
}
.logo {
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px;
}
</style>